package com.ibm.law.domain;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.IndexColumn;

/**
 * The persistent class for the employee database table.
 * 
 */
@Entity
public class Employee extends AbstractModelObject implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;

	private String name;

	// bi-directional many-to-one association to Deduction
	@OneToMany(mappedBy = "employee",cascade=CascadeType.REMOVE)
	private List<Deduction> deductions=new ArrayList<Deduction>();

	// bi-directional many-to-one association to Salary
	@OneToMany(mappedBy = "employee",cascade=CascadeType.REMOVE)
	private List<Salary> salaries=new ArrayList<Salary>();

	public Employee() {
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		String oldValue=this.name;
		this.name = name;
		firePropertyChange("name", oldValue, name);
	}

	public List<Deduction> getDeductions() {
		return this.deductions;
	}

	public void setDeductions(List<Deduction> deductions) {
		this.deductions = deductions;
	}

	public List<Salary> getSalaries() {
		return this.salaries;
	}

	public void setSalaries(List<Salary> salaries) {
		this.salaries = salaries;
	}

}